package com.yztc.yidoutang.activity.qwj_detail_activity;


import com.yztc.yidoutang.bean.QuanWuDetailBean;
import com.yztc.yidoutang.http.HttpHelper;
import com.yztc.yidoutang.http.QuanWuDetailService;

import java.util.Map;

import retrofit2.Retrofit;
import rx.Observable;
import rx.Observer;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Created by My on 2016/10/24.
 */

public class QuanWuDetailModel implements QuanWuDetailContract.Model{
    @Override
    public void getQuanWuDetailData(Map<String, String> params, final QuanWuDetailContract.OnLoadQuanWuDetailListener loadQuanWuDetailListener) {
        Retrofit retrofit= HttpHelper.getInstance().getRetrofit();
        Observable<QuanWuDetailBean> observable=retrofit.create(QuanWuDetailService.class).getQuanWuDetailList(params);
        observable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<QuanWuDetailBean>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {

            }

            @Override
            public void onNext(QuanWuDetailBean quanWuDetailBean) {
                loadQuanWuDetailListener.onSuccess(quanWuDetailBean);
            }
        });
    }
}

